home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / QuickDraw GX / Programming Stuff / Sample Code / Printing Samples / Applications… / Banana Jr. ƒ / Banana Jr.h < prev    next >
Encoding:
Text File  |  1996-03-20  |  3.5 KB  |  144 lines  |  [TEXT/KAHL]

  1. /*
  2.     included stuff for Banana Jr.
  3.  
  4.     created    9/2/92    Dave Hersey
  5.     
  6.     - - - - - - - - - - - - - - -
  7.     
  8.     9/93    updated to run with the ß2 "GXified" interface files - PLA
  9.     3/94    updated for B4 - dmh
  10.     3/94    general cleanup/debugging - dmh
  11.     8/94    universalized - dmh
  12. */
  13.  
  14.  
  15. // This is the structure we use to hold our private data for each page of a document.
  16.  
  17. typedef struct {
  18.               gxFormat        pageFormat;        // format for this page.
  19.               gxShape        pageShape;        // shape for this page.
  20.             } T_Page, *TP_Page, **TH_Page;
  21.  
  22.  
  23. // This is the structure we use to hold our private data for each document.  We store a handle to one of these beasties
  24. // in each window's refCon field.
  25.  
  26. typedef struct {
  27.               gxJob            docJob;            // print job for this document.
  28.               short            numPages;        // number of pages in this document. (one based)
  29.               short            curPage;        // current page being displayed. (one based)
  30.               WindowPtr        window;            // Document's WindowPtr.
  31.               gxViewPort    viewPort;        // Window's viewPort.
  32.               TH_Page        docPage[];        // array of pages in this document. (zero based)
  33.             } T_Doc, *TP_Doc, **TH_Doc;
  34.  
  35.  
  36.  
  37. #define    kBananaCollectionType    'bana'    // Item type for the 'bana' collection
  38.  
  39.  
  40. // BananaCollection - structure for our collection.  This format must match that
  41. // of the 'xdtl' in our resource file.
  42.  
  43. typedef struct
  44. {
  45.     char        one;
  46.     Boolean        two;
  47.     Boolean        three;
  48.     Boolean        four;
  49. }    T_BananaCollection, *TP_BananaCollection, **TH_BananaCollection;
  50.  
  51. //globals from main.c:
  52.  
  53. extern short             gAppResRefNum;
  54. extern Rect             gWindowQDRect;
  55. extern Str255            gWindowTitle;
  56. extern Boolean            gDebugging;
  57. extern Boolean            gGiveMeValidation;
  58. extern long                gGraphicsHeapSize;
  59. extern Boolean            gQuitting;
  60. extern long                gSleep;
  61.  
  62.  
  63.                     //  Prototypes: //
  64.  
  65. //main.c:
  66.  
  67. void main(void);
  68. OSErr MyPrintingEventOverride(EventRecord *anEvent, Boolean filterEvent);
  69.  
  70. //init.c:
  71.  
  72. OSErr DoDocInit(WindowPtr);
  73. void DoDraw(WindowPtr);
  74. OSErr DoCreateNew(void);
  75. void DoDispose(WindowPtr);
  76. void CreateSampleImage(TH_Doc doc, short whichPg);
  77.  
  78. //menus & windows.c:
  79.  
  80. void EventLoop(void);
  81. void MyDoEvent(EventRecord *theEvent);
  82. void DoMenuCommand(long menuResult);
  83. OSErr AddPage(TH_Doc doc, short *whichPg);
  84. void DisposePage(TH_Doc doc, short    whichPg);
  85. TH_Doc GetDoc(WindowPtr wind);
  86. TH_Page GetDocPage(TH_Doc doc, short whichPg);
  87. gxShape GetDocShape(TH_Doc doc, short whichPg);
  88. gxJob GetDocJob(TH_Doc doc);
  89.  
  90. //printing.c:
  91.  
  92. void SetUpEditMenuRec(gxEditMenuRecord *menuRec);
  93. OSErr DoDocFormat(WindowPtr wind, gxDialogResult *result);
  94. OSErr DoPageFormat(WindowPtr wind, gxDialogResult *result);
  95. OSErr DoPrinting(WindowPtr wind);
  96. OSErr MyPrintOneCopy(WindowPtr wind);
  97. OSErr DoPrintLoop(WindowPtr wind);
  98. void CheckForIdiots(gxFormat aFormat, gxShape pageShape);
  99. OSErr MyReplaceCollectionItem(void *newData, long collectSize,
  100.                               OSType collectType, long collectID,
  101.                               Collection whichCollection,
  102.                               Ptr *oldData, long *oldDataSize);
  103.  
  104. //panels.c:
  105.  
  106. OSErr PageFormatDialog(gxFormat aFormat, StringPtr title, gxDialogResult *result);
  107. OSErr SetUpByPagePanel(gxFormat aFormat, short ourResFile);
  108.  
  109.  
  110. // resource & menu item equates:
  111.  
  112. #define kFormatPanelResID    128
  113.  
  114. #define rMenuBar            128
  115. #define mApple                128
  116. #define     iAbout            1
  117.  
  118. #define mFile            129
  119. #define     iNew            1
  120. #define     iOpen            2
  121. #define     iClose            3
  122. #define     iSave            4
  123. #define     iDocSetup        6
  124. #define     iPageSetup        7
  125. #define     iPrint            8
  126. #define     iPrintOne        9
  127. #define     iQuit               11
  128.  
  129. #define mEdit            130
  130. #define     iUndo            1
  131. #define     iCut            3
  132. #define     iCopy            4
  133. #define     iPaste            5
  134. #define     iClear            6
  135.  
  136. #define mDocument        131
  137. #define     iAddPage        1
  138. #define     iDeletePage    2
  139. #define     iNextPage        4
  140. #define     iPrevPage        5
  141.  
  142.  
  143.  
  144.